Strict

Import agfx

Global myTmpScreen:TTmpScreen

Class TAgfx_test_app Extends TFramework

	Method OnCreate:Int()
		
		'DEVICE.SetFps(60)
		Super.OnCreate()
		
		APP.fps_On = True
		myTmpScreen = New TTmpScreen		
		myTmpScreen.Prepare()
		
		DEBUG = False
		
		Return 0
	End

	
End


Class TTmpScreen Extends TScreen
	
	Field spr:TSprite
	
	
	Field a:Float = 0
	
	' START when app is created
	Method Start:Void()
		
		IMAGES.LoadAnim("Ship1.png", 64, 64, 7, null)	
	
		Self.spr = New TSprite("Sprite0",IMAGES.Find("Ship1"),320,240)
		
		Self.spr.SetDebug(True)
		
		' test resize
		'---------------------------------------------------
		'Self.spr.SetSize(128,128)
		
		' test Flip in Y axis
		'---------------------------------------------------
		'Self.spr.SetFlip(False,True)
		

		' test - animation	event repeat/loop
		'---------------------------------------------------
		'Self.spr.SetAnimationEvent(0,6,125,True,True)

		' test - scale	event pingpong/loop
		'---------------------------------------------------
		'Self.spr.SetScaleEvent(20,0.1,0.1,True,True)

		' test - rotationevent pingpong/loop
		'---------------------------------------------------
		'Self.spr.SetRotationEvent(45,1,True,False)

		' test - alphaevent pingpong/loop
		'---------------------------------------------------
		
		Self.spr.SetAlphaEvent(100,0.01,0.0,True,TRUE)

		'DEBUG ON'
		DEBUG = True
	End
	
	' main app logic loop update
	Method Update:Void()
		
		
		a+=1
		' update direction vector from angle
		'---------------------------------------------------
		'Self.spr.rotation = a
		'Self.spr.SetDirectionByRotation()
		
		' test - move with delta [-1,0]
		'---------------------------------------------------
		'Self.spr.Move(-1,0)
		
		' test - move forward
		'---------------------------------------------------
		'Self.spr.MoveForward()
		
		'test - move to point
		'---------------------------------------------------
		'Self.spr.MoveTo(100,100)
		
		'test - look at
		'---------------------------------------------------
		'Self.spr.LookAt(MOUSE.x,MOUSE.y,True)
		
		' test - move in actual direction		
		'---------------------------------------------------
		'Self.spr.MoveForward()
		
		' test - move in right normal from actual direction		
		'---------------------------------------------------
		'Self.spr.Move(VecRightNormal(Self.spr.direction))
		
		'convert rotation to direction for RotationEvent
		'---------------------------------------------------
		'Self.spr.SetDirectionByRotation()

		Self.spr.Update()
	End
	
	' main app render loop
	Method Render:Void()
		Cls
		Self.spr.Draw()
		
	End
End







